<%--
  Created by IntelliJ IDEA.
  User: WYX
  Date: 2024/4/12
  Time: 8:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>实验一：乘法口诀表</title>
    <style>
        table, th, td {
            border: 1px solid black;
            border-collapse: collapse;
        }
    </style>
</head>
<body>
<table>
    <tr>
        <th colspan="9">乘法口诀表</th>
    </tr>
    <tr>
        <th colspan="9">1.0版</th>
    </tr>
    <tr>
        <td colspan="9">
            <%
                for (int i = 1; i < 10; i++)
                    for (int j = 1; j <= i; j++)
                        out.print(i + "x" + j + "=" + i * j + (i * j > 9 ? "" : "&nbsp;&nbsp;") + "&nbsp;&nbsp;&nbsp;" + (i == j ? "<br>" : ""));
            %>
        </td>
    </tr>
    <tr>
        <th colspan="9">2.0版</th>
    </tr>
    <%for (int i = 1; i < 10; i++) {%>
    <tr>
        <%for (int j = 1; j <= i; j++) {%>
        <td><%out.print(i + "x" + j + "=" + i * j);%></td>
        <%}%>
    </tr>
    <%}%>
    <tr>
        <th colspan="9">3.0版</th>
    </tr>
    <%
        for (int i = 9; i > 0; i--)
            for (int j = 1; j <= i; j++)
                out.print((j == 1 ? "<tr>" : "") + "<td>" + i + "x" + j + "=" + i * j + "</td>" + (i == j ? "</tr>" : ""));
    %>
</table>
</body>
</html>
